/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.startup.musicstore.app.factory;

import com.startup.musicstore.model.Contact;
import com.startup.musicstore.model.CreditCard;
import com.startup.musicstore.model.Customer;
import com.startup.musicstore.model.CustomerAddress;
import com.startup.musicstore.model.Demographic;
import com.startup.musicstore.model.Names;
import com.startup.musicstore.model.Order;
import java.util.List;

/**
 *
 * @author hashcode
 */
public class  CustomerFactory {

    public static class Builder {

        private String customerNumber;
        private Names names;
        private List<CreditCard> creditCard;
        private List<Order> order;
        private Contact contact;
        private Demographic demographic;
        private CustomerAddress customerAddress;

        public Builder(String customerNumber) {
            this.customerNumber = customerNumber;
        }

        public Builder Names(Names names) {
            this.names = names;
            return this;
        }

        public Builder Contact(Contact contacts) {
            this.contact = contacts;
            return this;
        }

        public Builder Demographic(Demographic demographic) {
            this.demographic = demographic;
            return this;
        }

        public Builder CustomerAddress(CustomerAddress customerAddress) {
            this.customerAddress = customerAddress;
            return this;
        }

        public Customer build() {
            return getCustomer(this);
        }

        private Customer getCustomer(Builder builder) {
            Customer cust = new Customer();
            cust.setCustomerNumber(builder.customerNumber);
            cust.setNames(builder.names);
            cust.setContact(builder.contact);
            cust.setCustomerAddress(builder.customerAddress);
            cust.setDemographic(builder.demographic);
            return cust;

        }
    }
}
